<?php
namespace Stay\Controller;
use Think\Controller;
class WxxyController extends CommonController {
    /**
     * 生产者 
     */
    public function mian(){
//         $redis = get_redis();
//         $info['url'] = "https://www.baidu.com";
//         $info['uid'] = "4321";
//         $info['token'] = "alkjsalkd";
//         $redis -> lpush ( 'urls',json_encode($info)) ;  //返回一个列表的长度2
        
//         die;
        //取十个个号
        
        //没问题就正常跑 如果总数达到要求了就先停止
        //每天的总数 每小时个数  最后一次操作时间  每个号次数
        
        //$wx_info_where['is_read'] = '1';
        $wx_info_where['status'] = '1';
        $wx_info_where['day_num'] = array('gt',0);
        $wx_info = M('wx_id')->where($wx_info_where)->limit(10)->select();
        //取没读过的任务
        foreach($wx_info as $wxinfo_k=>$wxinfo_v){
            $wx_read_where['uin'] = $wxinfo_v['uin'];
            $wx_read_where['status'] = 1;
            $readed_sql = M('WxRead')->field('aid')->where($wx_read_where)->getFetchSql()->select();
            $task_info = M('ReadTask')->where("NOT IN ({$readed_sql})")->limit($wxinfo_v['day_num'])->select();
            //记录一下分配过的
             
            
            //记录 某个uid每分钟读了多少
            
            //改redis
                 
            
        }
        
        
        
    }
    /**
     * 异常回报
     */
    public function read_report(){
        
    }
    
}